#ifndef STRATEGY_USER_1_H_
#define STRATEGY_USER_1_H_
#pragma once
#include "strategy_sys.h"

typedef struct userdata_stra1
{
	userdata_stra1()
	{
		point = 0;
		vol = 0;
	}
	unsigned int point;
	unsigned int vol;

}userdata_stra1;

class CStrategyUser1: public CStrategySys
{
public:// the public interface is very important called in framework, now only Run() is avalible, 
	// shouldn't add any interface, but could add private member called in Run() and conturctor;


	CStrategyUser1(string threadid):CStrategySys(threadid){};


	virtual ~CStrategyUser1(){};

private:

	virtual bool Init(BarInfo* pbar, map<string, vector<BarSeries*>>& mapuserbar, char* puserdata = NULL);

	virtual bool Destroy(BarInfo* pbar, map<string, vector<BarSeries*>>& mapuserbar);

	virtual bool Edit(BarInfo* pbar, char* puserdata);

	virtual void Run(BarData* ptickdata, char* inst);

	virtual void OnOrder(CThostFtdcOrderField *pOrder);

	virtual void OnTrade(CThostFtdcTradeField *pTrade);

	virtual void OnCancelOrder(CThostFtdcOrderField *pOrder);

	virtual void OnCancelOrderFailed(CThostFtdcInputOrderActionField *pCancelOrderFailed);

	virtual void OnStrategyCom(unsigned int size, char* pdata){};

private://///////defined for user strategy//////
	
	void Print_SyncOrder(CThostFtdcOrderField *order);

	bool StrGetmap(CThostFtdcTradeField* ptrade, OrderSysMap* &poutmap);

	bool Gettradevol(char* inst, TThostFtdcOrderRefType* porder, OrderSysMap* &poutmap, int* pvol);

	void UserRun(char* inst);

	void UseronOrder(CThostFtdcOrderField *pOrder);

	void UseronTrade(CThostFtdcTradeField *pTrade);

	void UseronCancelOrder(CThostFtdcOrderField *pOrder);

	void UseronCancelOrderFailed(CThostFtdcInputOrderActionField *pCancelOrderFailed);


	

};

#endif